package com.cat.chapter041;

/**
 * @author cat
 * @description 最大公约数
 * @create 2025/7/9 20:23
 * @since JDK17
 */

public class Solution01 {
    // 最大公约数算法
    public int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    // 最小公倍数
    public long lcm(int a, int b) {
        return (long) a / gcd(a, b) * b;
    }
    public static void main(String[] args) {
        Solution01 solution01 = new Solution01();
        System.out.println(solution01.gcd(50, 30));
        System.out.println(solution01.lcm(50, 30));
    }
}
